/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * CaseFrame.java
 *
 * Created on Sep 8, 2011, 3:59:09 AM
 */
package Views;

import Controllers.AccountDAO;
import Models.Account;
import Controllers.CaseHistoryDAO;
import Models.Cases;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import Models.PostMortem;
import Controllers.ManagingPosMortemDAO;

/**
 *
 * @author TranDangThuan
 */
public class CaseFrame extends javax.swing.JFrame {

    private DefaultComboBoxModel comModel;
    private DefaultTableModel tblModel;
    private List<Integer> accIDList = new ArrayList<Integer>();
    private int selectedRow; //used select item in  jtable
    private DefaultTableModel tblModel_FIR;
    private DefaultTableModel tblModel_Pos;
    private List<Integer> caseIDList = new ArrayList<Integer>();

    /** Creates new form CaseFrame */
    public CaseFrame() {
        initComponents();

        tblModel = new DefaultTableModel();
        tblModel.addColumn("ID");
        tblModel.addColumn("Case Type");
        tblModel.addColumn("Case Time");
        tblModel.addColumn("Reported Time");
        tblModel.addColumn("Approval Date");
        //tblModel.addColumn("Place");
        //tblModel.addColumn("Descriptions");
        tblModel.addColumn("Involvements");
        tblModel.addColumn("Status");
        tblModel.addColumn("Prosecution Desire");
        tblModel.addColumn("Lead OfficerID");
        tblCaseHistory.setModel(tblModel);

        comModel = new DefaultComboBoxModel();
        comLeadOfficerID.setModel(comModel);
        loadDataCombobox();
        //loadDataTable();
        txtCaseID.enable(false);
        
        //FIR
        tblModel_FIR = new DefaultTableModel();
        tblModel_FIR.addColumn("ID");
        tblModel_FIR.addColumn("Case Type");
        tblModel_FIR.addColumn("Case Time");
        tblModel_FIR.addColumn("Reported Time");
        tblModel_FIR.addColumn("Place");
        tblModel_FIR.addColumn("Descriptions");
        tblModel_FIR.addColumn("Involvements");
        tblModel_FIR.addColumn("Status");
        tblModel_FIR.addColumn("Prosecution Desire"); 
        tblModel_FIR.addColumn("Lead OfficerID");
        tblFIRManagement.setModel(tblModel_FIR);
        
        //PostMortem
        tblModel_Pos = new DefaultTableModel();
        tblModel_Pos.addColumn("Mortality ID");
        tblModel_Pos.addColumn("Mortality Name");
        tblModel_Pos.addColumn("Mortality Time");
        tblModel_Pos.addColumn("Case ID");
        tblModel_Pos.addColumn("Check In Date");
        tblModel_Pos.addColumn("Cause Of Death");
        tblModel_Pos.addColumn("Doctor Name");
        tblPosmortem.setModel(tblModel_Pos);
        loadDataCaseCombobox();
        loadDataAllTable();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblCaseHistory = new javax.swing.JTable();
        jPanel2 = new javax.swing.JPanel();
        ckProsecution = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtCaseDescriptions = new javax.swing.JTextArea();
        jLabel9 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        comLeadOfficerID = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtCasetype = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        spnnCaseTime = new javax.swing.JSpinner();
        jLabel7 = new javax.swing.JLabel();
        spnnReportTime = new javax.swing.JSpinner();
        spnnApprovalDate = new javax.swing.JSpinner();
        jLabel8 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtCasePlace = new javax.swing.JTextArea();
        combCaseStatus = new javax.swing.JComboBox();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtCaseInvolvements = new javax.swing.JTextArea();
        jLabel12 = new javax.swing.JLabel();
        txtCaseID = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        butSearch = new javax.swing.JButton();
        butAddNew = new javax.swing.JButton();
        butShow = new javax.swing.JButton();
        butEdit = new javax.swing.JButton();
        butDetail = new javax.swing.JButton();
        butReset = new javax.swing.JButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tblFIRManagement = new javax.swing.JTable();
        jPanel7 = new javax.swing.JPanel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        txtDelayReasons = new javax.swing.JTextField();
        txtInformationType = new javax.swing.JTextField();
        txtOffencePlace = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        txtInformerPhone = new javax.swing.JTextField();
        comLeadOfficerID1 = new javax.swing.JComboBox();
        jLabel20 = new javax.swing.JLabel();
        txtInformerAddress = new javax.swing.JTextField();
        jLabel21 = new javax.swing.JLabel();
        jLabel22 = new javax.swing.JLabel();
        txtStolenProperties = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        txtSuspectDescriptions = new javax.swing.JTextArea();
        jLabel24 = new javax.swing.JLabel();
        txtInformerName = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        txtOffenceTime = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        txtFIRTime = new javax.swing.JTextField();
        txtStolenValue = new javax.swing.JTextField();
        jPanel8 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        butEdit1 = new javax.swing.JButton();
        butAddNew1 = new javax.swing.JButton();
        butSearch1 = new javax.swing.JButton();
        jPanel9 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jLabel27 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tblPosmortem = new javax.swing.JTable();
        jPanel11 = new javax.swing.JPanel();
        jLabel28 = new javax.swing.JLabel();
        comboxCaseID = new javax.swing.JComboBox();
        jLabel29 = new javax.swing.JLabel();
        jLabel30 = new javax.swing.JLabel();
        jLabel31 = new javax.swing.JLabel();
        spnnMortalityTime = new javax.swing.JSpinner();
        jLabel32 = new javax.swing.JLabel();
        jLabel33 = new javax.swing.JLabel();
        spnnCheckInDate = new javax.swing.JSpinner();
        jScrollPane8 = new javax.swing.JScrollPane();
        txtMortalityName = new javax.swing.JTextArea();
        jScrollPane9 = new javax.swing.JScrollPane();
        txtCauseOfDeath = new javax.swing.JTextArea();
        jScrollPane10 = new javax.swing.JScrollPane();
        txtDoctorName = new javax.swing.JTextArea();
        jPanel12 = new javax.swing.JPanel();
        butEdit2 = new javax.swing.JButton();
        butSearch2 = new javax.swing.JButton();
        butAddNew2 = new javax.swing.JButton();
        butShow1 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel10.setBackground(new java.awt.Color(204, 204, 255));
        jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 18));
        jLabel10.setText("CASE HISTORY DETAILS MANAGEMENT ");

        tblCaseHistory.setBorder(new javax.swing.border.MatteBorder(null));
        tblCaseHistory.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tblCaseHistory.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tblCaseHistoryMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tblCaseHistory);

        jPanel2.setBackground(new java.awt.Color(204, 204, 204));
        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        ckProsecution.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        ckProsecution.setText("Prosecuted");

        txtCaseDescriptions.setColumns(20);
        txtCaseDescriptions.setRows(5);
        jScrollPane1.setViewportView(txtCaseDescriptions);

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel9.setText("Prosecution Desire:");

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel1.setText("Case Type:");

        comLeadOfficerID.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        comLeadOfficerID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel5.setText("Case Place:");

        jLabel11.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel11.setText("Serial Number:");

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel2.setText("Case Time:");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel4.setText("Approval Date:");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel3.setText("Reported Time:");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        jLabel7.setText("Case Involvements:");

        spnnApprovalDate.setEnabled(false);

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel8.setText("Case Status:");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel6.setText("Case Descriptions:");

        txtCasePlace.setColumns(20);
        txtCasePlace.setRows(5);
        jScrollPane3.setViewportView(txtCasePlace);

        combCaseStatus.setFont(new java.awt.Font("Tahoma", 0, 13));
        combCaseStatus.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));

        txtCaseInvolvements.setColumns(20);
        txtCaseInvolvements.setRows(5);
        jScrollPane4.setViewportView(txtCaseInvolvements);

        jLabel12.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel12.setText("Cases ID");

        jLabel13.setText("Search");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE)
                                        .addGap(72, 72, 72))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(81, 81, 81))
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jLabel12)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(spnnApprovalDate, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(txtCasetype, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
                                            .addComponent(spnnCaseTime, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)
                                            .addComponent(spnnReportTime, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))
                                        .addGap(29, 29, 29)))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 145, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(txtCaseID, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel13)
                        .addGap(93, 93, 93)))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel2Layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
                            .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 115, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)
                            .addComponent(combCaseStatus, 0, 143, Short.MAX_VALUE)
                            .addComponent(ckProsecution, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
                            .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(comLeadOfficerID, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 27, Short.MAX_VALUE)
                            .addComponent(txtCasetype, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(spnnCaseTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel2)))
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 65, Short.MAX_VALUE))
                .addGap(12, 12, 12)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(spnnReportTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3))
                    .addComponent(combCaseStatus, javax.swing.GroupLayout.Alignment.LEADING))
                .addGap(43, 43, 43)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(ckProsecution, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(spnnApprovalDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4)))
                .addGap(26, 26, 26)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.LEADING, 0, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 63, Short.MAX_VALUE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(comLeadOfficerID)
                            .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtCaseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel12))
                        .addGap(133, 133, 133)))
                .addContainerGap())
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(jLabel13)
                .addGap(147, 147, 147)
                .addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, 19, Short.MAX_VALUE)
                .addGap(218, 218, 218))
        );

        jPanel4.setBackground(new java.awt.Color(204, 204, 204));
        jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        butSearch.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        butSearch.setText("Search By CaseType");
        butSearch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butSearchActionPerformed(evt);
            }
        });

        butAddNew.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butAddNew.setText("Add New");
        butAddNew.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butAddNewActionPerformed(evt);
            }
        });

        butShow.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butShow.setText("Show All");
        butShow.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butShowActionPerformed(evt);
            }
        });

        butEdit.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butEdit.setText("Edit");
        butEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butEditActionPerformed(evt);
            }
        });

        butDetail.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butDetail.setText("Row Detail ");
        butDetail.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butDetailActionPerformed(evt);
            }
        });

        butReset.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butReset.setText("Reset ");
        butReset.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butResetActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(butReset, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                    .addComponent(butSearch, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(butEdit, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                    .addComponent(butShow, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                    .addComponent(butDetail, javax.swing.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE))
                .addContainerGap())
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                    .addGap(12, 12, 12)
                    .addComponent(butAddNew, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(54, 54, 54)
                .addComponent(butEdit)
                .addGap(18, 18, 18)
                .addComponent(butSearch)
                .addGap(26, 26, 26)
                .addComponent(butShow)
                .addGap(27, 27, 27)
                .addComponent(butDetail)
                .addGap(36, 36, 36)
                .addComponent(butReset)
                .addContainerGap(30, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel4Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(butAddNew)
                    .addContainerGap(280, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 815, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 795, Short.MAX_VALUE)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                            .addGap(119, 119, 119)
                            .addComponent(jLabel10))
                        .addGroup(jPanel3Layout.createSequentialGroup()
                            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addGap(10, 10, 10)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap()))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 681, Short.MAX_VALUE)
            .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel10)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(18, 18, 18)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 823, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 702, Short.MAX_VALUE)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 566, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(136, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Case", jPanel1);

        jLabel14.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jLabel14.setText("FIR MANAGEMENT ");

        tblFIRManagement.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane5.setViewportView(tblFIRManagement);

        jLabel15.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel15.setText("Information Type:");

        jLabel16.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel16.setText("Informer Phone:");

        jLabel17.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel17.setText("Informer Address:");

        jLabel18.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel18.setText("Suspect Descriptions:");

        txtDelayReasons.setFont(new java.awt.Font("Tahoma", 0, 13));

        txtInformationType.setFont(new java.awt.Font("Tahoma", 0, 13));

        txtOffencePlace.setFont(new java.awt.Font("Tahoma", 0, 13));

        jLabel19.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel19.setText("Offence Place:");

        comLeadOfficerID1.setFont(new java.awt.Font("Tahoma", 0, 13));
        comLeadOfficerID1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel20.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel20.setText("Stolen Properties:");

        jLabel21.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel21.setText("Stolen Value:");

        jLabel22.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel22.setText("Delay Reasons:");

        txtStolenProperties.setFont(new java.awt.Font("Tahoma", 0, 13));

        jLabel23.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel23.setText("Cases ID:");

        txtSuspectDescriptions.setColumns(20);
        txtSuspectDescriptions.setRows(5);
        jScrollPane6.setViewportView(txtSuspectDescriptions);

        jLabel24.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel24.setText("Informer Name:");

        txtInformerName.setFont(new java.awt.Font("Tahoma", 0, 13));

        jLabel25.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel25.setText("Offence Time:");

        jLabel26.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel26.setText("FIR Time:");

        txtFIRTime.setFont(new java.awt.Font("Tahoma", 0, 13));

        txtStolenValue.setFont(new java.awt.Font("Tahoma", 0, 13));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel24)
                    .addComponent(jLabel23)
                    .addComponent(jLabel15)
                    .addComponent(jLabel16)
                    .addComponent(jLabel17)
                    .addComponent(jLabel25)
                    .addComponent(jLabel19))
                .addGap(55, 55, 55)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(txtOffencePlace, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                    .addComponent(txtInformationType, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                    .addComponent(txtInformerPhone, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                        .addComponent(comLeadOfficerID1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtInformerName, javax.swing.GroupLayout.DEFAULT_SIZE, 157, Short.MAX_VALUE)
                        .addComponent(txtInformerAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 161, Short.MAX_VALUE)
                        .addComponent(txtOffenceTime)))
                .addGap(48, 48, 48)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel26)
                    .addComponent(jLabel18)
                    .addComponent(jLabel21)
                    .addComponent(jLabel20)
                    .addComponent(jLabel22))
                .addGap(24, 24, 24)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane6, 0, 0, Short.MAX_VALUE)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(txtStolenProperties)
                        .addComponent(txtDelayReasons)
                        .addComponent(txtStolenValue, javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(txtFIRTime, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtFIRTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel23)
                        .addComponent(comLeadOfficerID1))
                    .addComponent(jLabel26))
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel24)
                            .addComponent(txtInformerName))
                        .addGap(12, 12, 12))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(txtDelayReasons, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel22))))
                .addGap(8, 8, 8)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtStolenProperties, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel20)
                        .addComponent(txtInformerAddress)
                        .addComponent(jLabel17)))
                .addGap(18, 18, 18)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel16)
                        .addComponent(txtInformerPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(txtStolenValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel21))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel7Layout.createSequentialGroup()
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(jLabel18)
                                    .addComponent(txtOffenceTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel15))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtInformationType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel25))
                                .addGap(18, 18, 18)
                                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(txtOffencePlace)
                                    .addComponent(jLabel19)))
                            .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(30, 30, 30))
        );

        jButton1.setFont(new java.awt.Font("Tahoma", 0, 13));
        jButton1.setText("Show");

        butEdit1.setText("Edit");

        butAddNew1.setFont(new java.awt.Font("Tahoma", 0, 13));
        butAddNew1.setText("Add New");

        butSearch1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        butSearch1.setText("Search");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 102, Short.MAX_VALUE)
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(9, 9, 9)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jButton1, 0, 0, Short.MAX_VALUE)
                        .addComponent(butSearch1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(butEdit1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(butAddNew1, javax.swing.GroupLayout.Alignment.LEADING))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 187, Short.MAX_VALUE)
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel8Layout.createSequentialGroup()
                    .addGap(18, 18, 18)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel8Layout.createSequentialGroup()
                            .addGap(41, 41, 41)
                            .addComponent(butEdit1))
                        .addComponent(butAddNew1))
                    .addGap(18, 18, 18)
                    .addComponent(butSearch1)
                    .addGap(26, 26, 26)
                    .addComponent(jButton1)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 807, Short.MAX_VALUE)
            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel6Layout.createSequentialGroup()
                            .addGap(280, 280, 280)
                            .addComponent(jLabel14))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
                            .addComponent(jPanel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 787, Short.MAX_VALUE))
                    .addContainerGap()))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 521, Short.MAX_VALUE)
            .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel6Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel14)
                    .addGap(18, 18, 18)
                    .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(181, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("FIR", jPanel5);

        jLabel27.setBackground(new java.awt.Color(51, 0, 204));
        jLabel27.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jLabel27.setText("MANAGING POSMORTEM DETAILS");

        tblPosmortem.setBackground(new java.awt.Color(204, 204, 255));
        tblPosmortem.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane7.setViewportView(tblPosmortem);

        jPanel11.setBackground(new java.awt.Color(204, 204, 255));

        jLabel28.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel28.setText("Case ID:");

        comboxCaseID.setFont(new java.awt.Font("Tahoma", 0, 13));
        comboxCaseID.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jLabel29.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel29.setText("Doctor Name:");

        jLabel30.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel30.setText("Cause Of Death:");

        jLabel31.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel31.setText("Mortality Name:");

        jLabel32.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel32.setText("Mortality Time:");

        jLabel33.setFont(new java.awt.Font("Tahoma", 0, 13));
        jLabel33.setText("CheckIn Date:");

        txtMortalityName.setColumns(20);
        txtMortalityName.setRows(5);
        jScrollPane8.setViewportView(txtMortalityName);

        txtCauseOfDeath.setColumns(20);
        txtCauseOfDeath.setRows(5);
        jScrollPane9.setViewportView(txtCauseOfDeath);

        txtDoctorName.setColumns(20);
        txtDoctorName.setRows(5);
        jScrollPane10.setViewportView(txtDoctorName);

        javax.swing.GroupLayout jPanel11Layout = new javax.swing.GroupLayout(jPanel11);
        jPanel11.setLayout(jPanel11Layout);
        jPanel11Layout.setHorizontalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addGap(17, 17, 17)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel32)
                    .addComponent(jLabel31)
                    .addComponent(jLabel33))
                .addGap(10, 10, 10)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(spnnCheckInDate)
                    .addComponent(spnnMortalityTime)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(7, 7, 7)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel29)
                    .addComponent(jLabel30)
                    .addComponent(jLabel28))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
                    .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(comboxCaseID, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)))
                .addGap(32, 32, 32))
        );
        jPanel11Layout.setVerticalGroup(
            jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel11Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE)
                    .addComponent(jLabel31)
                    .addComponent(jLabel30)
                    .addComponent(jScrollPane9, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel11Layout.createSequentialGroup()
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(spnnMortalityTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel32)
                            .addComponent(jLabel29))
                        .addGap(34, 34, 34)
                        .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(spnnCheckInDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel33)))
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel11Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(comboxCaseID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel28))
                .addGap(49, 49, 49))
        );

        jPanel12.setBackground(new java.awt.Color(204, 204, 255));

        butEdit2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butEdit2.setText("Edit");

        butSearch2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
        butSearch2.setText("Search");

        butAddNew2.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butAddNew2.setText("Add New");
        butAddNew2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                butAddNew2ActionPerformed(evt);
            }
        });

        butShow1.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
        butShow1.setText("Show");

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(butAddNew2, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(butEdit2, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(butSearch2, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
                    .addComponent(butShow1, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addGap(15, 15, 15)
                .addComponent(butAddNew2)
                .addGap(18, 18, 18)
                .addComponent(butEdit2)
                .addGap(29, 29, 29)
                .addComponent(butSearch2)
                .addGap(26, 26, 26)
                .addComponent(butShow1)
                .addContainerGap(68, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 674, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jScrollPane7, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel10Layout.createSequentialGroup()
                                .addComponent(jPanel11, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(jPanel10Layout.createSequentialGroup()
                            .addGap(145, 145, 145)
                            .addComponent(jLabel27)))
                    .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 532, Short.MAX_VALUE)
            .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel10Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jLabel27)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jPanel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()))
        );

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 823, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(149, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 702, Short.MAX_VALUE)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(170, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("PostMortem", jPanel9);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 828, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void butAddNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butAddNewActionPerformed
        comLeadOfficerID.enable(true);
        SimpleDateFormat formatter = new SimpleDateFormat("DD/mm/yyyy");
        //||  ||  || 
        if (txtCasetype.getText().trim().length() == 0) {
            JOptionPane.showConfirmDialog(null, "You must Enter Case Type", "Error Message", JOptionPane.WARNING_MESSAGE);

        } else if (txtCasePlace.getText().trim().length() == 0) {
            JOptionPane.showConfirmDialog(null, "You must Enter Case Place", "Error Message", JOptionPane.WARNING_MESSAGE);

        } else if (txtCaseDescriptions.getText().trim().length() == 0) {
            JOptionPane.showConfirmDialog(null, "You must Enter Case Descriptions", "Error Message", JOptionPane.WARNING_MESSAGE);
        } else {
            Cases cases = new Cases();
            //set enable or disable Prosecution Desire
            cases.setProsecutionDesire(ckProsecution.isSelected());
            cases.setCaseType(txtCasetype.getText());
            //set time 
            String strCaseTime = formatter.format(spnnCaseTime.getValue());
            try {
                cases.setCaseTime(formatter.parse(strCaseTime));
            } catch (ParseException ex) {
                ex.printStackTrace();
            }
            String strReportTime = formatter.format(spnnReportTime.getValue());
            try {
                cases.setReportedTime(formatter.parse(strReportTime));
            } catch (ParseException ex) {
                ex.printStackTrace();
            }
            String strApprovalDate = formatter.format(spnnApprovalDate.getValue());
            try {
                cases.setApprovalDate(formatter.parse(strApprovalDate));
            } catch (ParseException ex) {
                ex.printStackTrace();
            }
            //set case place
            cases.setCasePlace(txtCasePlace.getText());
            //set case Descriptions
            cases.setCaseDescriptions(txtCaseDescriptions.getText());
            cases.setCaseInvolvements(txtCaseInvolvements.getText());
            cases.setCaseStatus(Integer.parseInt(combCaseStatus.getSelectedItem().toString()));
            //set case
            cases.setLeadOfficerID(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()));
            //System.out.println(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()) + 1);
            cases.setApprovalDirectorID(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()));
            if (CaseHistoryDAO.addNewCases(cases)) {
                JOptionPane.showConfirmDialog(null, "Add New successful", "Error Message", JOptionPane.WARNING_MESSAGE);
            } else {
                JOptionPane.showConfirmDialog(null, "Add New Not successful", "Error Message", JOptionPane.WARNING_MESSAGE);
            }
            //set case
        }
    }//GEN-LAST:event_butAddNewActionPerformed

    private void butShowActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butShowActionPerformed
        comLeadOfficerID.enable(true);
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");

        List<Cases> lisCase = CaseHistoryDAO.loadAllCase();
        while (tblModel.getRowCount() > 0) {
            tblModel.removeRow(0);
        }
        for (Cases cases : lisCase) {
            String strCaseTime = formatter.format(cases.getCaseTime());
            String strReportTime = formatter.format(cases.getReportedTime());
            String strApprovalDate = formatter.format(cases.getApprovalDate());
            tblModel.addRow(new String[]{cases.getCaseID() + "", cases.getCaseType(), strCaseTime, strReportTime, strApprovalDate,
                        cases.getCaseInvolvements(), cases.getCaseStatus() + "", cases.isProsecutionDesire() ? "Prosecuted" : "Unprosecuted", cases.getLeadOfficerID() + ""});
        }
    }//GEN-LAST:event_butShowActionPerformed

    private void butSearchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butSearchActionPerformed
        comLeadOfficerID.enable(true);
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
        String caseType = txtCasetype.getText();
        List<Cases> lisCase = CaseHistoryDAO.loadByCaseType(caseType);
        while (tblModel.getRowCount() > 0) {
            tblModel.removeRow(0);
        }
        for (Cases cases : lisCase) {
            String strCaseTime = formatter.format(cases.getCaseTime());
            String strReportTime = formatter.format(cases.getReportedTime());
            String strApprovalDate = formatter.format(cases.getApprovalDate());
            tblModel.addRow(new String[]{cases.getCaseID() + "", cases.getCaseType(), strCaseTime, strReportTime, strApprovalDate,
                        cases.getCaseInvolvements(), cases.getCaseStatus() + "", cases.isProsecutionDesire() ? "Prosecuted" : "Unprosecuted", cases.getLeadOfficerID() + ""});
        }
    }//GEN-LAST:event_butSearchActionPerformed

    private void tblCaseHistoryMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblCaseHistoryMouseClicked
        selectedRow = tblCaseHistory.getSelectedRow();
        String caseID = (String) tblCaseHistory.getValueAt(selectedRow, 0);
        //String caseType = (String) tblCaseHistory.getValueAt(selectedRow, 1);
        txtCaseID.setText(caseID);
        comLeadOfficerID.enable(false);
    }//GEN-LAST:event_tblCaseHistoryMouseClicked

    private void butEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butEditActionPerformed
        comLeadOfficerID.enable(true);
        SimpleDateFormat formatter = new SimpleDateFormat("DD/mm/yyyy");
        Cases cases = new Cases();
        //set enable or disable Prosecution Desire
        cases.setCaseID(Integer.parseInt(txtCaseID.getText()));
        cases.setProsecutionDesire(ckProsecution.isSelected());
        cases.setCaseType(txtCasetype.getText());
        //set time 
        String strCaseTime = formatter.format(spnnCaseTime.getValue());
        try {
            cases.setCaseTime(formatter.parse(strCaseTime));
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        String strReportTime = formatter.format(spnnReportTime.getValue());
        try {
            cases.setReportedTime(formatter.parse(strReportTime));
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        String strApprovalDate = formatter.format(spnnApprovalDate.getValue());
        try {
            cases.setApprovalDate(formatter.parse(strApprovalDate));
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        //set case place
        cases.setCasePlace(txtCasePlace.getText());
        //set case Descriptions
        cases.setCaseDescriptions(txtCaseDescriptions.getText());
        cases.setCaseInvolvements(txtCaseInvolvements.getText());
        cases.setCaseStatus(Integer.parseInt(combCaseStatus.getSelectedItem().toString()));
        //set case
        cases.setLeadOfficerID(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()));
        //System.out.println(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()) + 1);
        cases.setApprovalDirectorID(Integer.parseInt(comLeadOfficerID.getSelectedItem().toString()));

        if (CaseHistoryDAO.editCases(cases)) {
            JOptionPane.showConfirmDialog(null, "Edit successful", "Error Message", JOptionPane.WARNING_MESSAGE);
        } else {
            JOptionPane.showConfirmDialog(null, "Edit Not successful", "Error Message", JOptionPane.WARNING_MESSAGE);
        }
        //set case
    }//GEN-LAST:event_butEditActionPerformed

    private void butDetailActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butDetailActionPerformed
        if (tblCaseHistory.getSelectedRowCount() < 1) {
            JOptionPane.showMessageDialog(null, "No Casehostory selected!", "Error Message", JOptionPane.WARNING_MESSAGE);
        } else {
            selectedRow = tblCaseHistory.getSelectedRow();
            String _caseID = (String) tblCaseHistory.getValueAt(selectedRow, 0);
            //String caseType = (String) tblCaseHistory.getValueAt(selectedRow, 1);
            DialogCaseHistoryDetail detail = new DialogCaseHistoryDetail(null, true, new Cases(Integer.parseInt(_caseID)));
            detail.setSize(400, 300);
            detail.setVisible(true);
        }
    }//GEN-LAST:event_butDetailActionPerformed

    private void butResetActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butResetActionPerformed
        txtCaseDescriptions.setText(null);
        txtCaseID.setToolTipText(null);
        txtCaseInvolvements.setText(null);
        txtCasePlace.setText(null);
        txtCasetype.setText(null);
    }//GEN-LAST:event_butResetActionPerformed

    private void butAddNew2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_butAddNew2ActionPerformed
        SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss");
    if (txtMortalityName.getText().trim().length() == 0) {
        JOptionPane.showConfirmDialog(null, "You must Enter Mortality Name", "Error Message", JOptionPane.WARNING_MESSAGE);

    } else if (txtCauseOfDeath.getText().trim().length() == 0) {
        JOptionPane.showConfirmDialog(null, "You must Enter Cause Of Death", "Error Message", JOptionPane.WARNING_MESSAGE);
    } else if (txtDoctorName.getText().trim().length() == 0) {
        JOptionPane.showConfirmDialog(null, "You must Enter Doctor Name", "Error Message", JOptionPane.WARNING_MESSAGE);
    } else {
        PostMortem postMortem = new PostMortem();
        //set case ID
        postMortem.setCaseID(Integer.parseInt(comboxCaseID.getSelectedItem().toString()));
        //set causeOfDate
        postMortem.setCauseOfDeath(txtCauseOfDeath.getText());
        postMortem.setMortalityName(txtMortalityName.getText());
        postMortem.setDoctorName(txtDoctorName.getText());
        String strCheckInDate = formatter.format(spnnCheckInDate.getValue());
        String strMortalityTime = formatter.format(spnnCheckInDate.getValue());
        try {
            postMortem.setCheckInDate(formatter.parse(strCheckInDate));
            postMortem.setMortalityTime(formatter.parse(strMortalityTime));
        } catch (ParseException ex) {
            ex.printStackTrace();
        }
        //execu Update
        if (ManagingPosMortemDAO.addNewPosMortem(postMortem)) {
            JOptionPane.showConfirmDialog(null, "Add New successful", "Error Message", JOptionPane.WARNING_MESSAGE);
        }else JOptionPane.showConfirmDialog(null, "Add New not successful", "Error Message", JOptionPane.WARNING_MESSAGE);
    }
    }//GEN-LAST:event_butAddNew2ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton butAddNew;
    private javax.swing.JButton butAddNew1;
    private javax.swing.JButton butAddNew2;
    private javax.swing.JButton butDetail;
    private javax.swing.JButton butEdit;
    private javax.swing.JButton butEdit1;
    private javax.swing.JButton butEdit2;
    private javax.swing.JButton butReset;
    private javax.swing.JButton butSearch;
    private javax.swing.JButton butSearch1;
    private javax.swing.JButton butSearch2;
    private javax.swing.JButton butShow;
    private javax.swing.JButton butShow1;
    private javax.swing.JCheckBox ckProsecution;
    private javax.swing.JComboBox comLeadOfficerID;
    private javax.swing.JComboBox comLeadOfficerID1;
    private javax.swing.JComboBox combCaseStatus;
    private javax.swing.JComboBox comboxCaseID;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel28;
    private javax.swing.JLabel jLabel29;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel30;
    private javax.swing.JLabel jLabel31;
    private javax.swing.JLabel jLabel32;
    private javax.swing.JLabel jLabel33;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JSpinner spnnApprovalDate;
    private javax.swing.JSpinner spnnCaseTime;
    private javax.swing.JSpinner spnnCheckInDate;
    private javax.swing.JSpinner spnnMortalityTime;
    private javax.swing.JSpinner spnnReportTime;
    private javax.swing.JTable tblCaseHistory;
    private javax.swing.JTable tblFIRManagement;
    private javax.swing.JTable tblPosmortem;
    private javax.swing.JTextArea txtCaseDescriptions;
    private javax.swing.JTextField txtCaseID;
    private javax.swing.JTextArea txtCaseInvolvements;
    private javax.swing.JTextArea txtCasePlace;
    private javax.swing.JTextField txtCasetype;
    private javax.swing.JTextArea txtCauseOfDeath;
    private javax.swing.JTextField txtDelayReasons;
    private javax.swing.JTextArea txtDoctorName;
    private javax.swing.JTextField txtFIRTime;
    private javax.swing.JTextField txtInformationType;
    private javax.swing.JTextField txtInformerAddress;
    private javax.swing.JTextField txtInformerName;
    private javax.swing.JTextField txtInformerPhone;
    private javax.swing.JTextArea txtMortalityName;
    private javax.swing.JTextField txtOffencePlace;
    private javax.swing.JTextField txtOffenceTime;
    private javax.swing.JTextField txtStolenProperties;
    private javax.swing.JTextField txtStolenValue;
    private javax.swing.JTextArea txtSuspectDescriptions;
    // End of variables declaration//GEN-END:variables

    private void loadDataCombobox() {
        AccountDAO accDAO = new AccountDAO();
        ArrayList<Account> listAcc = accDAO.loadALL();
        comLeadOfficerID.removeAllItems();
        for (Account accounts : listAcc) {
            //comModel.addElement(accounts.getAccSerialNo());
            accIDList.add(accounts.getID());
            comLeadOfficerID.addItem(accounts.getID());
        }
    }
    
    private void loadDataCaseCombobox() {
        CaseHistoryDAO caseDAO = new CaseHistoryDAO();
        ArrayList<Cases> listCase = caseDAO.loadALL();
        comboxCaseID.removeAllItems();
        for (Cases cases : listCase) {
            caseIDList.add(cases.getCaseID());
            comboxCaseID.addItem(cases.getCaseID());
        }

    }

    private void loadDataAllTable() {
        
        List<PostMortem> listPostMortem = ManagingPosMortemDAO.loadAllPostMortem();
        while (tblPosmortem.getRowCount()>0) {            
            tblPosmortem.remove(0);
            
        }
        
        for (PostMortem postMortem : listPostMortem) {
            tblModel.addRow(new String[] {String.valueOf(postMortem.getCaseID()), postMortem.getMortalityName(),postMortem.getMortalityTime().toString()});
        }
    }
}